"""
the built-in type "type" is the built-in base factory. it is used to generate 
instances of any kind of class given its name, its base classes, and a 
mapping containing its attributes

__metaclass__ can be added in a class definition to interact with the creation process

the __metaclass__ attribute must be set to something that will
1: accept the same arguments as those that "type" accepts
   (a class name, a tuple of base classes, and a mapping of attributes)
2: return a class object

"""
def method(self):
    return 1
klass = type('MyClass', (object,), {'method2':method})
instance = klass()
print instance.method2()
